package com.itv.email.data;

import org.apache.log4j.Logger;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * User: bjxiajun
 * Date: 14-5-20
 * Time: 下午2:23
 */
public class ConfUtil {
    private static Logger logger = Logger.getLogger(ConfUtil.class);
    public static int serverNum;
    public static Properties prop;

    static {
        InputStream is = null;
        try {
            is = Thread.currentThread().getContextClassLoader().getResourceAsStream("email/email.properties");
            prop = new Properties();
            prop.load(is);
            serverNum = Integer.parseInt(prop.getProperty("server.num"))+1;
        } catch (IOException e) {
            logger.error("读取配置文件出错。", e);
        } finally {
            if (is != null) {
                try {
                    is.close();
                } catch (IOException e) {
                }
            }
        }
    }

    public static String getPropertie(String key) {
        return prop.getProperty(key);
    }
}
